package com.cloud.system.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cloud.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Size;

/**
 * 参数配置表 sys_config_info
 *
 * @author yzj
 */
@Data
@Schema(name = "参数配置对象", description = "系统管理")
@TableName("sys_config_info")
public class SysConfig extends BaseEntity {

    @Excel(name = "主键", orderNum = "1", width = 15)
    @TableId(value = "config_id", type = IdType.AUTO)
    private Long configId;

    @Schema(description = "参数名称")
    @Excel(name = "参数名称", orderNum = "2", width = 15)
    private String configName;

    @Schema(description = "参数键名")
    @Excel(name = "参数键名", orderNum = "3", width = 15)
    private String configKey;

    @Schema(description = "参数键值")
    @Excel(name = "参数键值", orderNum = "4", width = 15)
    private String configValue;

    @Schema(description = "系统内置(Y=是,N=否)")
    @Excel(name = "系统内置", orderNum = "5", width = 10, replace = {"是_Y", "否_N"})
    private String configType;

    @Schema(description = "备注")
    @Excel(name = "备注", orderNum = "6", width = 20)
    private String remark;

    @NotBlank(message = "参数名称不能为空")
    @Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
    public String getConfigName() {
        return configName;
    }

    @NotBlank(message = "参数键名长度不能为空")
    @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
    public String getConfigKey() {
        return configKey;
    }

    @NotBlank(message = "参数键值不能为空")
    @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
    public String getConfigValue() {
        return configValue;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("configId", getConfigId())
                .append("configName", getConfigName())
                .append("configKey", getConfigKey())
                .append("configValue", getConfigValue())
                .append("configType", getConfigType())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
